* read in the data
use "/Users/brucedesmarais/Dropbox/professional/Research/Submitted/Camp/Data/CandidateCluster/RepMergedGrps.dta", clear

* DemNotTriv is an indicator of whether any Democrat in the race was not in the big catch-all cluster
* RepNotTriv '' '' Republican '' ''

* create non-trivial non-incumbent variables
gen NTrivRChal = RepNotTriv*(1-inc_rep)
gen NTrivDChal = DemNotTriv*(1-inc_dem)

* replicate Woon and Pope's model, adding in our variables
* note, because of the shorter timespan in our data, we can only really replicate their first model
* there is not enough variation on some of the ivs to estimate the other models
estimates drop _all

* TABLE 2
xtreg dhv incmid incpha incpha_negxgap incpha_posxgap presvote inc_dem chqual_dem chqual_rep south dmidterm NTrivRChal NTrivDChal C700008721990_R-C001782692000_D if incumb!="Open", re i(year)
estimates store t21





